# 导入requests 模块
import requests
import re
# 用一个变量去存储三创的网址
url1="https://www.sanchuangedu.cn/"

# 得到网址的源代码
url=requests.get('https://www.sanchuangedu.cn')
url_text = url.text

# 用正则表达式得到 .jpg后缀的图片
result = re.findall(r"(?<=img src=\").*\.jpg", url_text)
print(result)

#
j=0
for i in result:
    j+=1
    jpg1 = requests.get(url1+i)
    # 将获得的内容
    jpg=jpg1.content
    f = open(rf'F:\三创图片\第{j}张.jpg','wb')
    f.write(jpg)
    f.close()

msg = "san chuang tong le, welcom ,'hello world', learn python"
ret=re.findall(r"(?<!\')\b\w+\b(?!\')|(?:(?<=\')\w+\s\w+(?=\'))",msg)
# ret = re.findall(r"(?:(?<=\')\w+\s\w+(?=\'))", msg)
print(ret)
